//
// AWS Manager - A free AWS console application demonstrating advanced concepts
// Copyright (C) 2008-2010 Sean O'Dell. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.awsmanager.common;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author Sean ODell
 */
public class EBSVolume {

    /* volume information */
    private String volumeRegion;
    private String volumeId;
    private int size;
    private String snapshotId;
    private String zone;
    private String vstatus;
    private String createTime;
    private int vDurationHours;
    /* attachment information */
    private String instanceId;
    private String device;
    private String astatus;
    private String attachTime;
    private int aDurationHours;
    /* meta data */
    private String volname;
    private String voldesc;
    private String volownernamelast;
    private String volownernamefirst;
    private String volownerdept;

    private String instname;
    private String snapname;


    /** Creates a new instance of EBSVolume */
    public EBSVolume() {
    }

    public String getVolumeRegion() {
        return volumeRegion;
    }

    public void setVolumeRegion(String volumeRegion) {
        this.volumeRegion = volumeRegion;
    }

    public String getvolumeId() {
        return volumeId;
    }

    public void setvolumeId(String volumeId) {
        this.volumeId = volumeId;
    }

    public int getsize() {
        return size;
    }

    public void setsize(String size) {
        this.size = Integer.parseInt(size);
    }

    public String getsnapshotId() {
        return snapshotId;
    }

    public void setsnapshotId(String snapshotId) {
        this.snapshotId = snapshotId;
    }

    public String getzone() {
        return zone;
    }

    public void setzone(String zone) {
        this.zone = zone;
    }

    public String getvstatus() {
        return vstatus;
    }

    public void setvstatus(String status) {
        this.vstatus = status;
    }

    public String getcreateTime() {
        return createTime;
    }

    public void setcreateTime(Calendar createTime) {
        Date createDate = createTime.getTime();
        Date currentDate = new Date();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");

        double diff = currentDate.getTime() - createDate.getTime();

        this.createTime = dateFormat.format(createDate);
        this.vDurationHours = (int) Math.ceil(diff / (1000 * 60 * 60));
    }

    public int getvDurationHours() {
        return vDurationHours;
    }

    public String getinstanceId() {
        return instanceId;
    }

    public void setinstanceId(String instanceId) {
        this.instanceId = instanceId;
    }

    public String getdevice() {
        return device;
    }

    public void setdevice(String device) {
        this.device = device;
    }

    public String getastatus() {
        return astatus;
    }

    public void setastatus(String astatus) {
        this.astatus = astatus;
    }

    public String getattachTime() {
        return attachTime;
    }

    public void setattachTime(Calendar attachTime) {
        Date attachDate = attachTime.getTime();
        Date currentDate = new Date();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");

        double diff = currentDate.getTime() - attachDate.getTime();

        this.attachTime = dateFormat.format(attachDate);
        this.aDurationHours = (int) Math.ceil(diff / (1000 * 60 * 60));
    }

    public void setattachTime(String attachTime) {
        this.attachTime = attachTime;
        this.aDurationHours = 0;
    }

    public int getaDurationHours() {
        return aDurationHours;
    }

    public String getvolname() {
        return volname;
    }

    public void setvolname(String volname) {
        this.volname = volname;
    }

    public String getvoldesc() {
        return voldesc;
    }

    public void setvoldesc(String voldesc) {
        this.voldesc = voldesc;
    }

    public String getvolownernamelast() {
        return volownernamelast;
    }

    public void setvolownernamelast(String volownernamelast) {
        this.volownernamelast = volownernamelast;
    }

    public String getvolownernamefirst() {
        return volownernamefirst;
    }

    public void setvolownernamefirst(String volownernamefirst) {
        this.volownernamefirst = volownernamefirst;
    }

    public String getvolownerdept() {
        return volownerdept;
    }

    public void setvolownerdept(String volownerdept) {
        this.volownerdept = volownerdept;
    }

    public String getInstname() {
        return instname;
    }

    public void setInstname(String instname) {
        this.instname = instname;
    }

    public String getSnapname() {
        return snapname;
    }

    public void setSnapname(String snapname) {
        this.snapname = snapname;
    }
}